package com.fenxiangle.yueding.feature.home.model;

import com.fenxiangle.yueding.entity.bo.FoucsBo;
import com.fenxiangle.yueding.entity.bo.HomeDataBo;
import com.fenxiangle.yueding.entity.bo.HomeFilterBo;
import com.fenxiangle.yueding.entity.bo.LoginPram;
import com.fenxiangle.yueding.feature.home.contract.HomeContract;
import com.fenxiangle.yueding.feature.home.dependencies.home.DaggerHomeModelComponent;
import com.fenxiangle.yueding.feature.login.contract.LoginContract;
import com.fenxiangle.yueding.feature.login.dependencies.login.DaggerLoginModelComponent;
import com.fenxiangle.yueding.framework.api.ApiLib;
import com.fenxiangle.yueding.framework.api.HomeApi;
import com.fenxiangle.yueding.framework.api.UserApi;
import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.UserInfoBo;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

public class HomeModel implements HomeContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public HomeModel() {
        DaggerHomeModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<List<HomeDataBo>> getHomeData(HomeFilterBo homeFilterBo) {
        return api.getHomeData(homeFilterBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> attentionFollow(FoucsBo homeFilterBo) {
        return api.attentionFollow(homeFilterBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> attentionUnFollow(FoucsBo homeFilterBo) {
        return api.attentionUnFollow(homeFilterBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
